UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4UgcuK+3f1RF5ScSwgVxsztga/exwyxR2Ioxdul5kCQ='
WHERE
key_id = 'e47b1778563e6b35fef2b504f5b827ef77fa42cc93f6614c004d26c2ce0b0311'
AND (
token = '4UgcuK+3f1RF5ScSwgVxsztga/exwyxR2Ioxdul5kCQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)