UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RhETjynGkOxCcM49f+iNYMVEqajLfd3V+mB7ynk7a6c=' 
WHERE 
  key_id = '9d2d0164319c2cdc9b608d9f3fcb015d49735aa40bdb4d184ded0dbe20e47ad4' 
  AND (
    token = 'RhETjynGkOxCcM49f+iNYMVEqajLfd3V+mB7ynk7a6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036