UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3PZjn/rqeW08aO8owuS+8YniRmbS3nGgPo4y51drEEo=' 
WHERE 
  key_id = '6d448e9e43c1374cb4cadc3a04c17db80b75fba665aa2de18c96b37b83a5ae54' 
  AND (
    token = '3PZjn/rqeW08aO8owuS+8YniRmbS3nGgPo4y51drEEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045