UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xl+KpKyxdwfZtHlVlPDzjnhhvE/rifaHCoao9Qaf5Wo=' 
WHERE 
  key_id = '53861c6b010d735540a0928da4f51d79e200c9477b383d2c57bd9524a50264a4' 
  AND (
    token = 'xl+KpKyxdwfZtHlVlPDzjnhhvE/rifaHCoao9Qaf5Wo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028