UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iP/AW3KmMxI1pR+sMf1RR0znZozssN70K9TMGKyiUE0=' 
WHERE 
  key_id = '40b7351c8e3405b6d255102bc724c1df27212174d4cfe32e4513c83ea0c9e284' 
  AND (
    token = 'iP/AW3KmMxI1pR+sMf1RR0znZozssN70K9TMGKyiUE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025