UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dBBDvw4m5db8RCDYu/TDdEg15wvVMfe2rdCsVo2dua4=' 
WHERE 
  key_id = 'd78ac1901387c679ff6926fda1824ce9a24c7ae422485eac77dd3b2f24111018' 
  AND (
    token = 'dBBDvw4m5db8RCDYu/TDdEg15wvVMfe2rdCsVo2dua4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032