UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l/Ssu1Bt6IV3n796VTb7lbnQK6sronL+EP0NV9NIbF4=' 
WHERE 
  key_id = '326d126c904ab8f3284792a8c0db98455ab9a159514a98934f92aa6828640e88' 
  AND (
    token = 'l/Ssu1Bt6IV3n796VTb7lbnQK6sronL+EP0NV9NIbF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034