UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gjkT3yEYmPJYfkh2MQWm+2gIJYguZts46NvfjAIIEBg=' 
WHERE 
  key_id = '1bd630e726109d08daead4766ba59bd6fe766947cb5d25c2681ba07a9291132c' 
  AND (
    token = 'gjkT3yEYmPJYfkh2MQWm+2gIJYguZts46NvfjAIIEBg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051