UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'shBRLsH8IFTSdF4bBvhqWJWSYkY5XxRxeKYI988p4Mo=' 
WHERE 
  key_id = '74098ad5a92d65a71fab0c0ce15425c6851403e752a2bdfa30fd783f75535618' 
  AND (
    token = 'shBRLsH8IFTSdF4bBvhqWJWSYkY5XxRxeKYI988p4Mo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045