UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IZCU4khQPxbMV/K8CMdM4Lrpbc6/CdrCz4qlgVGJ0O8=' 
WHERE 
  key_id = '7e09ed3c6b29520fecd0d8568a8d9245517f227ad55938bceb5ffa08de878058' 
  AND (
    token = 'IZCU4khQPxbMV/K8CMdM4Lrpbc6/CdrCz4qlgVGJ0O8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035