UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g8sC8f3nopizJ6RoLY06/6dyyAa5psIoL3wp5szkl1k=' 
WHERE 
  key_id = '5d5b924d2444237c3418b87aea936fdb782c4aeb128ffadb5c11bba6e182a7b3' 
  AND (
    token = 'g8sC8f3nopizJ6RoLY06/6dyyAa5psIoL3wp5szkl1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048