UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '20Y1523vSejOctvJskpuomghDwYXZ3iXuCyifTLy6p4='
WHERE
key_id = '6f86d65141ac3ff7347c2bba12fd58f79259e3c651a678c541055794a7990f97'
AND (
token = '20Y1523vSejOctvJskpuomghDwYXZ3iXuCyifTLy6p4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)