UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R4Fmq5oT+oVaVTRe0AQJJ1DjZem/PG3U1Ho6EGDpIC4='
WHERE
key_id = 'a727b0457d674d27e3235e889cdfb59c2255126c56a71bacbe0207c70f05d963'
AND (
token = 'R4Fmq5oT+oVaVTRe0AQJJ1DjZem/PG3U1Ho6EGDpIC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)