UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E4gOpcqDGUQwzz26CxPa+G6P5Uk8+R4sXyvcGJn2abo=' 
WHERE 
  key_id = 'c8afa08bea50b47ca7efbc2590124402949b6843a23f02af6935e737c96fafdb' 
  AND (
    token = 'E4gOpcqDGUQwzz26CxPa+G6P5Uk8+R4sXyvcGJn2abo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032