UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oJht6TKi+TM28zpYmp7e0UqgqD97TcgIfSfeBfLVE+E='
WHERE
key_id = 'e7355ddd4e349726b84304a884ef399af93920d77d1f2415a19df75e05fbbef3'
AND (
token = 'oJht6TKi+TM28zpYmp7e0UqgqD97TcgIfSfeBfLVE+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)