UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h8zRkcq8ixDNOKnvq+Ku40Rydr+tV5rD6SqHozSFTTk=' 
WHERE 
  key_id = '877a1386b54e32d41456c49511208821831d7f2e201aab12b69663d61c0c25b1' 
  AND (
    token = 'h8zRkcq8ixDNOKnvq+Ku40Rydr+tV5rD6SqHozSFTTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025