UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vimT6OpXzPfPVFdc+yO1tBBRl+vvbKpQkZtDc5FHQic=' 
WHERE 
  key_id = '18b58a8876363a386f12d4f873285a1b34f222519760b114d3aca9883459ff95' 
  AND (
    token = 'vimT6OpXzPfPVFdc+yO1tBBRl+vvbKpQkZtDc5FHQic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040