UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bEDQ9ynOVcEbN/O879tOhtju1N5YcM2v5koX+n2eo6o=' 
WHERE 
  key_id = 'f5deedb7c1731c5d3470a41831e8bcb159ff90797a0a506c43dd155987777e34' 
  AND (
    token = 'bEDQ9ynOVcEbN/O879tOhtju1N5YcM2v5koX+n2eo6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025