UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jpvEZbC+nPqntnLYRnoDLb53WemJBiY6NREcLH8Kv00=' 
WHERE 
  key_id = '41662f8a6606e60bd5d2f3987e4c3a1d677d73d73408f4615e3321602d383d6f' 
  AND (
    token = 'jpvEZbC+nPqntnLYRnoDLb53WemJBiY6NREcLH8Kv00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023