UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NqB2FDHgBnb3od2lv6UPMnWINqpHsochZ9nojANNcsc=' 
WHERE 
  key_id = '6363683b7d61c2a4c139134523747afdcf9142977eb9527e68339cd5228ad54e' 
  AND (
    token = 'NqB2FDHgBnb3od2lv6UPMnWINqpHsochZ9nojANNcsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045