UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4gyi+5j6BvoEBoDHhP11gZgWxKZ3AeP3BLtN+KZVEKw=' 
WHERE 
  key_id = '90909c61bde0617a0595014cede0d54b00dcb13a04c66586b762a376797feedb' 
  AND (
    token = '4gyi+5j6BvoEBoDHhP11gZgWxKZ3AeP3BLtN+KZVEKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033