UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SDL6qHCd+5OV0otllZ7Z84k0myvxfYcL+akODNKuPz8='
WHERE
key_id = 'e514fd866b309ebd8a8c94884516bb02d9bc62ca3d636aa8a5c60d94d88ff780'
AND (
token = 'SDL6qHCd+5OV0otllZ7Z84k0myvxfYcL+akODNKuPz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)