UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lQYcIYUidbn8bBcY9vr2rYGwN0xovpD+NO7d9V2v3xg=' 
WHERE 
  key_id = '478b9693e5174e9ae0dabb8d3308d91a8999625511bd5ea6cca9eda5c5c1bbbd' 
  AND (
    token = 'lQYcIYUidbn8bBcY9vr2rYGwN0xovpD+NO7d9V2v3xg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029