UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lTkCPf+bWb7qPGpWkcqJFdPkzIEPRQTequBVCYI0oQk=' 
WHERE 
  key_id = '77ed21a26fe442d361b3642341493976a0ebeae1e538e1a85f66221258a2139f' 
  AND (
    token = 'lTkCPf+bWb7qPGpWkcqJFdPkzIEPRQTequBVCYI0oQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034