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