UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'grdQLU8fThrVBHJqZEND1yfamFYxLdZNTZYWSfgqqFE=' 
WHERE 
  key_id = '1d6f819b3a4897021828cf195bac72c045aac6efad2974ad4002b19a25f4c482' 
  AND (
    token = 'grdQLU8fThrVBHJqZEND1yfamFYxLdZNTZYWSfgqqFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032