UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k+sVk2MsUGsfaIzKBdD1R5opV//SUYBmDfdY8SqJ+4s=' 
WHERE 
  key_id = 'd993942de6c85a2e515bd095f1e5f091d509cdf639deb165128d281e6228e340' 
  AND (
    token = 'k+sVk2MsUGsfaIzKBdD1R5opV//SUYBmDfdY8SqJ+4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031