UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KCyz75das9SaeKBcObwVNnjPyZuS8gaVYg1aecLlCpA=' 
WHERE 
  key_id = '0360f093b398a7f7fe2c4375e1dca08767644b414ca496b51a3438bf3097fc93' 
  AND (
    token = 'KCyz75das9SaeKBcObwVNnjPyZuS8gaVYg1aecLlCpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018