UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'azW9DEBPHIVVlvmn9p325cJzk8LnCHOD4BArlZMkIRI='
WHERE
key_id = 'a009c7bd9b1c1a7edd925f3cfdce5299357afa57e877dfee3d7cf2464002ae6f'
AND (
token = 'azW9DEBPHIVVlvmn9p325cJzk8LnCHOD4BArlZMkIRI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)