UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lc0eWqBtG7plA/rFxmK7+vpZQUpA2ECCzLj26U2Twzk=' 
WHERE 
  key_id = '613656c60363485cb467510ac53e568fd08c2d4753fe8d7634b0f9432be18307' 
  AND (
    token = 'Lc0eWqBtG7plA/rFxmK7+vpZQUpA2ECCzLj26U2Twzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041