UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jBnnWMN9v2dD86pBTYlHediAXUVOiT/Hce9DG6UCdzA=' 
WHERE 
  key_id = '6ff69bd993736613ca65d24e39527ef4b54c4922447175a86bf91c5bac3e61e1' 
  AND (
    token = 'jBnnWMN9v2dD86pBTYlHediAXUVOiT/Hce9DG6UCdzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023