UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PqIrJrijcOX/lpvv0l+NZG+w13te2VVctHV/hkl0x5U=' 
WHERE 
  key_id = '3b0891da684886b854573fcd3f5d70271793ce60c7ba68fe3529543a12966ed8' 
  AND (
    token = 'PqIrJrijcOX/lpvv0l+NZG+w13te2VVctHV/hkl0x5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023