UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XN8GGCswaRQg6WxaSXbmQJLiVMH4g7d98XvKPtoyTPs=' 
WHERE 
  key_id = '18327ca7df830c4f0efbbe8bc81d318d71079052af073a68a2797f64fc28d566' 
  AND (
    token = 'XN8GGCswaRQg6WxaSXbmQJLiVMH4g7d98XvKPtoyTPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033