UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GLkh7lcgxoUoh4FfW3Of3pUMDIErurWY3ETt4rpwWtc=' 
WHERE 
  key_id = 'd8612bf72c215c49339fe9c471af53e20860662904b0f0789c137cac767b2bc0' 
  AND (
    token = 'GLkh7lcgxoUoh4FfW3Of3pUMDIErurWY3ETt4rpwWtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032