UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9KOwLFQmXMs4mLZLM0MLmwO0eN/9pWdv9BC8ZKVCFr0=' 
WHERE 
  key_id = '52d17b7ec72928c01c8e2741b19f3c416dcfc11e5f396e8b3376e9e52846a77f' 
  AND (
    token = '9KOwLFQmXMs4mLZLM0MLmwO0eN/9pWdv9BC8ZKVCFr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00012