UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GAP+vvotetcynGngdpLYiY8jpseRKXK9q96teYuhXyA=' 
WHERE 
  key_id = 'bcbf1237037cda6a48bcdbd349da6e51bd6a5a5981088534359ae82a1968ded9' 
  AND (
    token = 'GAP+vvotetcynGngdpLYiY8jpseRKXK9q96teYuhXyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036