UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZLp/6KfqY3fqH4Zmhxhlk8LaBgQgXe+qrbXXbE8gGDg=' 
WHERE 
  key_id = '60971a45532b415531e8890b03254c38af7988390c2277d329e42cb71840a354' 
  AND (
    token = 'ZLp/6KfqY3fqH4Zmhxhlk8LaBgQgXe+qrbXXbE8gGDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026