UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c1wgyXA4TlhiyR84Gt+N5uhbTkoUUFLZ37h/ZmTfPKk=' 
WHERE 
  key_id = 'af0b7b2278de4cee4daab9bd11b5d96c436237bb93dffc0c92042238a7332160' 
  AND (
    token = 'c1wgyXA4TlhiyR84Gt+N5uhbTkoUUFLZ37h/ZmTfPKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041