UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pIcmajsI9N6C1rAXN2DhQ7cI1BEE4y1IWWRB98Ss1VA=' 
WHERE 
  key_id = '9fc29fdcb45d9a6640801f836e9e69061cc79f745876e9b9ad80eb244ac6aef0' 
  AND (
    token = 'pIcmajsI9N6C1rAXN2DhQ7cI1BEE4y1IWWRB98Ss1VA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038