UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zUheaQ0JCSHuy5I56T+BnvYMhrmdkG2+RPLFBoH9xOk='
WHERE
key_id = '5d2cfaed91c8998422a23033985029884b81c52b965d4a86be4800ea070d3d5b'
AND (
token = 'zUheaQ0JCSHuy5I56T+BnvYMhrmdkG2+RPLFBoH9xOk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)