UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'afJKBiFvpZGXToIMbxYL4/bstX0v1OngDMwymluTCBM=' 
WHERE 
  key_id = '45f52713aa17987c634519af8acc5f5e7b8025e093d1c2776597469b0f5ad601' 
  AND (
    token = 'afJKBiFvpZGXToIMbxYL4/bstX0v1OngDMwymluTCBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054