UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ijTQOtUkF77zgZ7Li3dJsg3fi1bQXeJnqdrugqSbdfE=' 
WHERE 
  key_id = '006a42fcf85b3664d811bfdfee17adc8571877d3cb1d9fd51cd9c39898675428' 
  AND (
    token = 'ijTQOtUkF77zgZ7Li3dJsg3fi1bQXeJnqdrugqSbdfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064