UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PJv/89MNDvrb6DP74Fh88a40N1EakTPY/H48j68r+GY=' 
WHERE 
  key_id = '9c047860eb869d9b0311f4dd2c10c8bd84f46066f8d99f08b4737f08412a27b8' 
  AND (
    token = 'PJv/89MNDvrb6DP74Fh88a40N1EakTPY/H48j68r+GY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023