UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'unXtu9DZgGmrzeyN9qO6miTbCrhk9ZK/c5ME1iq+P4I=' 
WHERE 
  key_id = 'd0fb1460b8b51da4f3388365e4e7243944d14117b6117214726fa650dbc54a60' 
  AND (
    token = 'unXtu9DZgGmrzeyN9qO6miTbCrhk9ZK/c5ME1iq+P4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048