UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jXlmFDAfDrnoHOvEc3CgslxXcBdjwOIvY/qmWINXI0s=' 
WHERE 
  key_id = '8efe4b66ce1035ea9a4109992ee8845875542ee7b0f0c05a538d04e969c9360d' 
  AND (
    token = 'jXlmFDAfDrnoHOvEc3CgslxXcBdjwOIvY/qmWINXI0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032