UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8hTaGD0+abKTCQJUCLttjb5b8O3wRHGufpQt9/W773M=' 
WHERE 
  key_id = 'edcaba3502309f56eb75be5259d0b839dd3f85bbb3c2a7dcba859c511b8b82ed' 
  AND (
    token = '8hTaGD0+abKTCQJUCLttjb5b8O3wRHGufpQt9/W773M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047