UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SNiQpEzfuDk5oYosVMP8CJX96LZQp07jORGacw2tFOw=' 
WHERE 
  key_id = '5ea04017542fcc7064a16b77eccf17c67d9613e1b4b139c7b5465f2121e9c885' 
  AND (
    token = 'SNiQpEzfuDk5oYosVMP8CJX96LZQp07jORGacw2tFOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026