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

Query time 0.00046