UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJso/+mD7bdZFAswyC9FzMTgxSgefIEHBi7Qmgbbx+Y=' 
WHERE 
  key_id = '56bff7afdf3e8d0df441931ed3659409da515eddffdc09aee484193bf09b2d01' 
  AND (
    token = 'AJso/+mD7bdZFAswyC9FzMTgxSgefIEHBi7Qmgbbx+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033