UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VS9i7Z+bIA/Jch2xhhOR6+PAlWxKQX2P11sGSiufRGo=' 
WHERE 
  key_id = '0f6a1d52b459b1a0b1fab4868d9750cc31f55aaea9c70c5a65904e75c24dae99' 
  AND (
    token = 'VS9i7Z+bIA/Jch2xhhOR6+PAlWxKQX2P11sGSiufRGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038